﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using MyHotel_DTO;
using MyHotel_Common;

namespace MyHotel_DAO
{
    public class BaoCaoDoanhThuDAO : DAO
    {
        protected override object createObjectFromDatarow(DataRow row)
        {
            ChiTietDoanhThu ctdoanhthu = new ChiTietDoanhThu();
            ctdoanhthu.Tenloaiphong = row["Tenloaiphong"].ToString();
            ctdoanhthu.Doanhthu = Convert.ToInt32(row["Doanhthu"].ToString());
            ctdoanhthu.Tile = Convert.ToDouble(row["Tile"].ToString());
            return ctdoanhthu;
        }
        
        public List<ChiTietDoanhThu> getListDoanhThuThang(int thang)
        {
            
            string namestore = "usp_Baocaodoanhthuthang";
            SqlParameter para = new SqlParameter("@Thang", thang);
            DataTable dt = DataProvider.executeStoreProcedureQuery(namestore, para);
            return getListFromDataTable<ChiTietDoanhThu>(dt);
        }
        public List<ChiTietDoanhThu> getListDoanhThuNam()
        {
            List<ChiTietDoanhThu> listdoanhthu = new List<ChiTietDoanhThu>();
            string namestore = "usp_Baocaodoanhthunam"; 
            DataTable dt = DataProvider.executeStoreProcedureQuery(namestore, null);
            return getListFromDataTable<ChiTietDoanhThu>(dt);
        }
    }
}
